﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using SmartWMS.API.Controllers;
using SmartWMS.Common.ResponseOutput;
using SmartWMS.Domain.Base;
using SmartWMS.Server.SystemSets.Dictionary;
using SmartWMS.Server.SystemSets.Dictionary.Dto;

namespace SmartWMS.API.Controllers.SystemSet
{
    /// <summary>
    /// 公共字典控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    [ApiExplorerSettings(GroupName = "XTong")]
    public class DictionaryController : TransientController
    {
        private readonly IDictionarySerivce _systemSetSerivce;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="systemSetSerivce"></param>
        public DictionaryController(IDictionarySerivce systemSetSerivce)
        {
            _systemSetSerivce = systemSetSerivce;
        }

        /// <summary>
        /// 添加公共字典
        /// </summary>
        /// <param name="systemSetsInput"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Response<bool>> AddSystemSet(SystemSetsInput systemSetsInput)
        {
            var resault= _systemSetSerivce.AddSystemSet(systemSetsInput);

            return await resault;
        }

        /// <summary>
        /// 公共字典列表
        /// </summary>
        /// <param name="systemSetsInput"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Response<List<SystemSetsInput>>> GetSStaffListAsync(string? typeName)
        {
            var resault = _systemSetSerivce.GetSStaffListAsync(typeName);
            return await resault;
        }

        /// <summary>
        /// 添加字典明细
        /// </summary>
        /// <param name="systemSetsDto"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Response<bool>> AddSystemSetDetail(SystemSetsDto systemSetsDto)
        {
            var resault=_systemSetSerivce.AddSystemSetDetail(systemSetsDto);

            return await resault;
        }

        /// <summary>
        /// 字典明细列表
        /// </summary>
        /// <param name="Info"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Response<List<SystemSetsDto>>> GetResponseListAsync(SystemSetsDto Info)
        {
            var resault=_systemSetSerivce.GetResponseListAsync(Info);

            return await resault;
        }

        /// <summary>
        /// 反填字典明细
        /// </summary>
        /// <param name="Info"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Response<SystemSetsDto>> GetSystemSetDetailAsync(KeyEntity Info)
        {
            var resault=_systemSetSerivce.GetSystemSetDetailAsync(Info);

            return await resault;
        }

        /// <summary>
        /// 反填公共字典
        /// </summary>
        /// <param name="Info"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Response<SystemSetsInput>> GetSystemSetAsync(KeyEntity Info)
        {
            var resault=_systemSetSerivce.GetSystemSetAsync(Info);

            return await resault;
        }

        /// <summary>
        /// 修改公共字典
        /// </summary>
        /// <param name="systemSetsInput"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Response<bool>> UpdateSystemSet(SystemSetsInput systemSetsInput)
        {
            var resault=_systemSetSerivce.UpdateSystemSet(systemSetsInput);

            return await resault;
        }

        /// <summary>
        /// 修改字典明细
        /// </summary>
        /// <param name="systemSetsDto"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Response<bool>> UpdateSystemSetDetail(SystemSetsDto systemSetsDto)
        {
            var resault=_systemSetSerivce.UpdateSystemSetDetail(systemSetsDto);

            return await resault;
        }

        /// <summary>
        /// 状态修改
        /// </summary>
        /// <param name="Info"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Response<bool>> UpdateState(SystemSetsInput Info)
        {
            var resault = _systemSetSerivce.UpdateState(Info);

            return await resault;
        }

        /// <summary>
        /// 字典明细状态修改
        /// </summary>
        /// <param name="Info"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Response<bool>> UpdateDetailState(SystemSetsDto Info)
        {
            var resault=_systemSetSerivce.UpdateDetailState(Info);

            return await resault;
        }
        
    }
}
